RDD_electoral_losers_rdd_with_abstainers <- function(
  data, rdd_model
) {

  # initial binding of globals
  `%>%` <- magrittr::`%>%`
  win_cabinet <- relative_date <- NULL

  # electoral losers only
  df_losers <- dplyr::filter(.data = data, win_cabinet == 0)

  # losers
  tmp_losers_all <- df_losers %>%
    # drop observations where the running variable is 0
    dplyr::filter(relative_date  != 0)

  # RDD losers
  m_losers <- rdd_model(
    data = tmp_losers_all,
    outcome = "swd",
    clustervar = "election",
    running.var = "relative_date"
  )

  # results table to print
  out <- tibble::tibble(
    method = c(
      "Conventional", "Bias-Corrected", "Robust", "N",
      "BW est. (std.)", "BW est. (robust)"
    ),
    coefficient = c(
      round(m_losers$coef[, 1], 2),
      round(m_losers$N[2], 2),
      paste0(round(m_losers$bws[1, ], digits = 0), collapse = "/"),
      paste0(round(m_losers$bws[2, ], digits = 0), collapse = "/")
    ),
    lower_bound = c(round(m_losers$ci[, 1], 2), NA, NA, NA),
    upper_bound = c(round(m_losers$ci[, 2], 2), NA, NA, NA)
  )

  # save results
  write.csv(
    x = out,
    file = "./tables/table_S_D1.csv",
    row.names = FALSE
  )

}